package com.wanaofu.service;

import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import com.wanaofu.model.ProductInfo;

public class HomeServeice {
	private static Map<String,ProductInfo> pro = new HashMap<String,ProductInfo>();

	private HomeServeice(){;}
	
	public static void init(List<ProductInfo> allP) {
		System.out.println("++++++++++++++++++=======================");
		System.out.println("++++++++++++++++++" + allP.size() + "=======================");
		
		for (Iterator iterator = allP.iterator(); iterator.hasNext();) {
			ProductInfo o = (ProductInfo) iterator.next();
			pro.put(o.getCode(), o);
		}
	}
	
	public static ProductInfo getProductInfo(String key) {
		return pro.get(key);
	}
	
	public static Collection<ProductInfo> getAllProductInfos() {
		return pro.values();
	}
	
	
}
